'   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '           N a m e :   P L C _ E m u l a t o r _ 0 7 . t x t                                     D a t e :     1 4   O c t o b e r   2 0 2 0 
 
 '         A u t o r :   L e o n a r d o   D E   P A L O   P h . D . 
 
 '         S c o p e :   E m u l a t i n g   P L C   s e n d i n g   s e r i a l   d a t a   f o r   D i g i S c r e w   t e s t i n g . 
 
 '         P l a t e :   1 5 3 0   T X B . 
 
 '       L e n g h t :   9   -   1 2   -   1 3   -   1 4   -   1 5   -   1 6   -   1 7   -   1 8   -   1 9   -   2 2   -   2 6 
 
 '   H a r d w a r e :   U S B   t o   S e r i a l   R S 2 3 2   a d a p t e r 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L o a d   T o c . w a v 
 
 O p t i o n   S p e e d   9 
 
 
 
 v 1   =   1 2 
 
 C O M   O p e n   v 1   9 6 0 0 
 
 s 1   =   C O M _ S t a t u s 
 
 P r i n t   s 1   +   " :   "   +   v 1   +   "       V A L I D :   "   +   C O M _ P o r t N a m e s 
 
 
 
 B u t t o n   1   T e x t   " 1 8   F O R E V E R " 
 
 B u t t o n   2   T e x t   " 9 " 
 
 B u t t o n   3   T e x t   " 1 2 " 
 
 B u t t o n   4   T e x t   " 1 3 " 
 
 B u t t o n   5   T e x t   " 1 4 " 
 
 B u t t o n   6   T e x t   " 1 5 " 
 
 B u t t o n   7   T e x t   " 1 6 " 
 
 B u t t o n   8   T e x t   " 1 7 " 
 
 B u t t o n   9   T e x t   " 1 8 " 
 
 B u t t o n   1 0   T e x t   " 1 9 " 
 
 B u t t o n   1 1   T e x t   " 2 2 " 
 
 B u t t o n   1 2   T e x t   " 2 6 " 
 
 
 
 B u t t o n   1 4   T e x t   " S T A R T " 
 
 B u t t o n   1 5   T e x t   " S T O P " 
 
 B u t t o n   1 6   T e x t   " C L O S E   A L L " 
 
 
 
 B u t t o n   1   C o l o r   Y e l l o w 
 
 B u t t o n   2   C o l o r   Y e l l o w G r e e n 
 
 B u t t o n   3   C o l o r   Y e l l o w G r e e n 
 
 B u t t o n   4   C o l o r   Y e l l o w G r e e n 
 
 B u t t o n   5   C o l o r   Y e l l o w G r e e n 
 
 B u t t o n   6   C o l o r   Y e l l o w G r e e n 
 
 B u t t o n   7   C o l o r   Y e l l o w G r e e n 
 
 B u t t o n   8   C o l o r   Y e l l o w G r e e n 
 
 B u t t o n   9   C o l o r   L a w n G r e e n 
 
 B u t t o n   1 0   C o l o r   Y e l l o w G r e e n 
 
 B u t t o n   1 1   C o l o r   Y e l l o w G r e e n 
 
 B u t t o n   1 2   C o l o r   Y e l l o w G r e e n 
 
 
 
 B u t t o n   1 4   C o l o r   G r e e n 
 
 B u t t o n   1 5   C o l o r   R e d 
 
 B u t t o n   1 6   C o l o r   B l a c k 
 
 
 
 ' L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ H A L . e x e 
 
 ' L o a d   . . \ T h e r e m i n o _ T e r m i n a l _ R X \ T h e r e m i n o _ T e r m i n a l . e x e 
 
 ' L o a d   . . \ T h e r e m i n o _ T e r m i n a l _ T X \ T h e r e m i n o _ T e r m i n a l . e x e 
 
 ' L o a d   . . \ T h e r e m i n o _ H A L \ T h e r e m i n o _ S l o t V i e w e r . e x e 
 
 ' L o a d   . . \ T h e r e m i n o _ H A L \ T h e r e m i n o _ S i g n a l S c o p e . e x e 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   R e m e m b e r   l a s t   t o t a l s 
 
 L o a d   V a r s 
 
 
 
 ' C o n t r o l s   O p e n T e x t B o x 
 
 
 
 S t o p                                                                                         ' 
 
 
 
 L a b e l   C L O S E   A L L 
 
 	 L o a d   C l o s e A p p s 
 
 R e t u r n 
 
 
 
 L a b e l   E v e n t S t o p 
 
 	 S a v e   V a r s 
 
 E n d                                                                                           ' 
 
 
 
 
 
 L a b e l   1 8   F O R E V E R 
 
 	 s 2   =   " " 
 
 	 F o r   v 1   =   1   T o   9 e 9 9 
 
 	 	 s 1   =   " 1 8 M 4 C W "   +   C R L F 
 
 	 	 C O M   W r i t e S t r i n g   s 1 
 
 	 	 F o r   v 2   =   1   T o   1 e 9 9 
 
 	 	 	 s 2   =   s 2   +   C O M _ R e c e i v e d 
 
 	 	 	 S e l e c t   s 2 
 
 	 	 	 	 C a s e   " A K " 
 
 	 	 	 	 	 s 2   =   " " 
 
 	 	 	 	 C a s e   " O K " 
 
 	 	 	 	 	 s 2   =   " " 
 
 	 	 	 	 	 v 7   =   v 7   +   1 
 
 	 	 	 	 	 E x i t 
 
 	 	 	 	 C a s e   " N O " 
 
 	 	 	 	 	 s 2   =   " " 
 
 	 	 	 	 	 L o a d   " s i r e n a . w a v " 
 
 	 	 	 	 	 W a i t   S e c o n d s   2 
 
 	 	 	 	 	 v 8   =   v 8   +   1 
 
 	 	 	 	 	 v 7   =   v 7   +   1 
 
 	 	 	 	 	 E x i t 
 
 	 	 	 E n d S e l e c t 
 
 	 	 N e x t 
 
 	 	 P r i n t   "   T e s t   n u m :   "   +   v 7   +   "   E r r o r s :   "   +   v 8 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   9 
 
 	 s 1   =   " 9 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   1 2 
 
 	 s 1   =   " 1 2 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   1 3 
 
 	 s 1   =   " 1 3 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   1 4 
 
 	 s 1   =   " 1 4 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   1 5 
 
 	 s 1   =   " 1 5 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   1 6 
 
 	 s 1   =   " 1 6 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   1 7 
 
 	 s 1   =   " 1 7 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   1 8 
 
 	 s 1   =   " 1 8 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   1 9 
 
 	 s 1   =   " 1 9 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   2 2 
 
 	 s 1   =   " 2 2 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   2 6 
 
 	 s 1   =   " 2 6 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   S T A R T 
 
 	 S l o t ( 1 4 )   =   1 0 0 0 	 	 ' s h o w   s t a r t   s i g n a l 
 
 	 s 1   =   " S T A R T "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 	 S l o t ( 1 4 )   =   0 	 	 ' s h o w   s t o p   s i g n a l 
 
 R e t u r n 
 
 
 
 L a b e l   2 0 M 4 C W 
 
 	 S l o t ( 1 4 )   =   1 0 0 0 	 	 ' s h o w   s t a r t   s i g n a l 
 
 	 s 1   =   " 2 0 M 4 C W "   +   C R L F 
 
 	 W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 	 S l o t ( 1 4 )   =   0 	 	 ' s h o w   s t o p   s i g n a l 
 
 R e t u r n 
 
 
 
 L a b e l   2 M 4 C C W 	 	 	 ' s h o w   s t a r t   s i g n a l 
 
 	 S l o t ( 1 4 )   =   1 0 0 0 
 
 	 s 1   =   " 2 M 4 C C W "   +   C R L F 
 
 	 ' W a i t   S e c o n d s   0 . 0 2 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 	 S l o t ( 1 4 )   =   0 	 	 ' s h o w   s t o p   s i g n a l 
 
 R e t u r n 
 
 
 
 L a b e l   S T O P 	 	           	 ' s h o w   s t a r t   s i g n a l 
 
 	 S l o t ( 1 4 )   =   1 0 0 0   +   C R L F 
 
 	 ' W a i t   S e c o n d s   0 . 0 2 
 
 	 s 1   =   " S T O P "   +   C R L F 
 
 	 C O M   W r i t e S t r i n g   s 1 
 
 	 P r i n t   s 1 
 
 	 S l o t ( 1 4 )   =   0 	 	 ' s h o w   s t o p   s i g n a l 
 
 R e t u r n 
 
 
 
 
 
 ' W A T C H   C O M _ S t a t u s 
 
 